<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>新增小组</title>
<link rel="stylesheet" type="text/css" href="../easyui/themes/default/easyui.css" />
<link rel="stylesheet" type="text/css" href="../easyui/themes/icon.css" />
<link rel="stylesheet" type="text/css" href="../css/pop-page.css" />
<script type="text/javascript" src="../easyui/jquery-1.8.0.min.js"></script>
<script type="text/javascript" src="../easyui/jquery.easyui.min.js"></script>
<script type="text/javascript" src="../easyui/locale/easyui-lang-zh_CN.js"></script>
<script type="text/javascript" src="../js/win.js"></script>
<script type="text/javascript">
	function initForm(){
		$('#fm').form({ 
			url : "../group/addGroup.do",  
		    onSubmit: function(){
		    	var name = $("#name").val();
		    	if($.trim(name) == ""){
		    		$.messager.alert("提示", "&nbsp;&nbsp;<br/>请输入名称!", "info");
			    	return false;
		    	}
		    	var leaderId = $("#leaderId").val();
		    	if(leaderId == ""){
		    		$.messager.alert("提示", "&nbsp;&nbsp;<br/>请选择组长!", "info");
			    	return false;
		    	}
		    	return true;
		    },  
		    success:function(msg){
		        if("success" == msg){
		        	parent.reloadDg();
		        } else {
		        	$.messager.alert('Warning','<br />' + msg);
		        }
		    }
		});
	}
	
	$(function(){
		initForm();
	});
	
	function openSelectUser(){
		openUrl("选择人员", 300, 300, "selectUser.jsp");
	}
	
	function selectUser(id, name){
		$("#leaderName").val(name);
		$("#leaderId").val(id);
		closeWin();
	}
</script>
</head>
<body class="easyui-layout">
	<div data-options="region:'center',border:false">
		<form id="fm" method="post">
			<div class="dg-content">
				<table style="margin-top: 30px" cellspacing="10px">
					<tr>
						<td align="right" style="padding-right: 5px;width: 30%">类型</td>
						<td>
							<select class="easyui-combobox" name="group.type" 
								data-options="panelHeight: 'auto'" style="width: 150px">
								<option value="1">人员组</option>
								<option value="2">侍奉组</option>
							</select>
						</td>
					</tr>
					<tr>
						<td align="right" style="padding-right: 5px;width: 30%">名称</td>
						<td><input type='text' id="name" name="group.name" class='in-text'/>
							<font color="red">&nbsp;*</font>
						</td>
					</tr>
					<tr>
						<td align="right" style="padding-right: 5px">组长</td>
						<td><input type='text'  class='in-text' id="leaderName" 
								readonly="readonly" onfocus="openSelectUser()"/>
							<input type="hidden" name="group.leader.id" id="leaderId"/>
							<font color="red">&nbsp;*</font> 
						</td>
					</tr>
					<tr>
						<td align="right" style="padding-right: 5px">备注</td>
						<td>
							<textarea style="width: 250px;height: 60px" name="group.remark"></textarea>
						</td>
					</tr>
				</table>
			</div>
		</form>
	</div>
	<div data-options="region:'south'" class='fm-btn'>
		<a href="#" class="easyui-linkbutton" iconCls="icon-ok" onclick="$('#fm').submit();">确定</a>
		<a href="#" class="easyui-linkbutton" iconCls="icon-cancel" onclick="parent.closeWin()">取消</a>
	</div>
</body>
</html>